import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import AboutView from '../views/AboutView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home/index'
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView,
    children: [{
      path: 'index',
      name: '/home/index',
      component: () => import('../views/index/index.vue'),
    },
    
    // 推荐审核状态路由
    
    {
      path: 'toplist',
      name: 'toplist',
      component: () => import('../views/toplist/toplist.vue'),
    }, {
      path: 'echarts',
      name: 'echarts',
      component: () => import('../views/echarts/echarts.vue'),
    }, {
      path: 'myuser',
      name: 'myuser',
      component: () => import('../views/myuser/myuser.vue'),
    },
    ]
  },
  // 上传页面路由
    {
      path: '/upload',
      component: () => import('../views/index/upload.vue'),
    },
    // 修改审核页面路由
    {
      path: '/upload_xiugai',
      component: () => import('../views/index/upload_xiugai.vue'),
    },
  // 登录注册欢迎页面
  {
    path: '/about',
    name: 'about',
    component: AboutView,
  },
  {
    path: '/shenhe',
    name: '/shenhe',
    component: () => import('../views/myuser/tuijian.vue'),
  },
  // 收藏路由
  {
    path: '/shoucang',
    name: '/shoucang',
    component: () => import('../views/myuser/shoucang.vue'),
  },
  // 添加登录及注册路由
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/login.vue'),
  }, {
    path: '/register',
    name: '/register',
    component: () => import('../views/login/register.vue'),
  },
  // 详情页面
  {
    path: '/xiangqing/:id/:type',
    component: () => import('../views/toplist/xiangqing.vue'),
  },
  // 收藏详情页面
  {
    path: '/xiangqing_sc/:id',
    component: () => import('../views/toplist/xiangqing_sc.vue'),
  },
  // 更多评论页面
  {
    path: '/pinglun/:cat_id',
    component: () => import('../components/pinglun.vue'),
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
